home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / dosmodem.arc / AT.ASM next >
Assembly Source File  |  1986-10-13  |  2KB  |  148 lines

  1. upcase    macro    char
  2.     local    nocvt
  3.  
  4.     ifb    <char>
  5.  
  6.     upcase    al
  7.  
  8.     else
  9.  
  10.     cmp    char,'a'
  11.     jb    nocvt
  12.     cmp    char,'z'
  13.     ja    nocvt
  14.     sub    char,32
  15. nocvt:
  16.     endif
  17.     endm
  18.  
  19.  
  20.  
  21.     page    66,132
  22.  
  23. cseg    segment    byte public 'CODE'
  24.     assume    cs:cseg,ds:cseg,es:cseg
  25.     org    100h
  26.  
  27. start    proc    near
  28.     jmp    start1
  29.  
  30.     db    13,'AT (pd)1985,86 by Donavon Kuhn',13,10,26
  31.  
  32. base    dw    0
  33.  
  34. start1:
  35.     lea    dx,author
  36.     mov    ah,9
  37.     int    21h
  38.  
  39.     mov    bl,0            ;default com port (COM1:)
  40.     mov    si,80h
  41. start2:
  42.     inc    si
  43.     mov    al,[si]            ;space off leading spaces
  44.     cmp    al,' '
  45.     jz    start2
  46.  
  47.     cmp    al,'?'
  48.     jz    errexit
  49.  
  50.     upcase                ;using UPCASE without a parameter
  51.     cmp    al,'C'            ;(defaults to AL)
  52.     jnz    nocom
  53.  
  54.     mov    cl,[si][1]
  55.     upcase    cl            ;using UPCASE using another register
  56.     cmp    cl,'O'
  57.     jnz    nocom
  58.                 
  59.  
  60.     mov    al,[si][2]
  61.     upcase    al            ;using UPCASE with AL as the parm
  62.     cmp    al,'M'
  63.     jnz    nocom
  64.  
  65.     cmp    byte ptr [si][4],':'
  66.     jz    check_port
  67.  
  68. errexit:
  69.     lea    dx,errmsg
  70. errexit1:
  71.     mov    ah,9
  72.     int    21h
  73.  
  74.     mov    ax,4c01h        ;return ERRORLEVEL of 1
  75.     int    21h
  76.  
  77. check_port:
  78.     mov    al,[si][3]        ;get the com number
  79.     sub    al,'1'            ;convert to binary
  80.     cmp    al,3            ;greater than com4?
  81.     ja    errexit
  82.  
  83.     add    si,5
  84.  
  85.     mov    bl,al
  86. nocom:
  87.     xor    bh,bh    
  88.     shl    bl,1
  89.     mov    ax,40h
  90.     mov    ds,ax
  91.     mov    ax,ds:[bx]
  92.     push    cs
  93.     pop    ds
  94.  
  95.     cmp    ax,0
  96.     jnz    comok
  97.  
  98.     lea    dx,ncstr
  99.     jmp    errexit1
  100.  
  101.  
  102. comok:
  103.     mov    base,ax
  104.  
  105.     mov    al,'A'
  106.     call    auxout
  107.     mov    al,'T'
  108.     call    auxout
  109.  
  110. outlp:
  111.     mov    al,[si]
  112.     inc    si
  113.     call    auxout
  114.     cmp    al,13
  115.     jnz    outlp
  116.  
  117.     mov    ax,4c00h
  118.     int    21h
  119.  
  120. author    db    'AT (pd)1985,86 by Donavon Kuhn',13,10,'$'
  121. errmsg    db    'Usage:  AT [COM1:|COM2:|COM3:|COM4:] command string',13,10,'$'
  122. ncstr    db    'COM port not found',13,10,'$'
  123.  
  124.  
  125. auxout    proc    near
  126.     push    ax
  127.     mov    dx,base
  128.     add    dx,5
  129.  
  130. txlp:
  131.     in    al,dx
  132.     and    al,20h
  133.     jz    txlp
  134.  
  135.     pop    ax
  136.     sub    dx,5
  137.     out    dx,al    
  138.     ret
  139. auxout    endp
  140. ;
  141. ;---------------
  142. ;
  143. start    endp
  144.  
  145. cseg    ends
  146.         end    start
  147. 
  148.